package com.bigdata.security.shiro.listener;/**
 * Created by Administrator on 2019/7/9 0009.
 */

import org.apache.shiro.session.Session;
import org.apache.shiro.session.SessionListener;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author Administrator
 * @description
 * @date 2019/7/9 0009
 */
@Configuration
public class ShiroSessionListener implements SessionListener {
    public final AtomicInteger sessionCount = new AtomicInteger(0);

    @Override
    public void onStart(Session session) {
        sessionCount.incrementAndGet();
    }

    @Override
    public void onStop(Session session) {
        sessionCount.decrementAndGet();
    }

    @Override
    public void onExpiration(Session session) {
        sessionCount.decrementAndGet();
    }
}
